<template>
	<view>
		<!-- 头部 -->
		<view class="header">
			<view class="header-right">
				<view class="text" @click="handleJump">注册</view>
			</view>
		</view>
		
		<!-- 中间logo -->
		<view class="center_logo">
			<image src="../../static/image/login/logo.png"></image>
		</view>
		
		<!-- 登录 -->
		<view class="login_warp">
			<view class="login_title">
				登录
			</view>
			<view class="login_news">
				您好，欢迎来到 yike！
			</view>
			<view class="login_username">
				<input type="text" value="" placeholder="用户名/邮箱" @blur="getUser"/>
			</view>
			<view class="login_password">
				<input type="password" value="" placeholder="密码" @blur="getPws"/>
			</view>
			<view class="tips"  v-show="false">
				输入用户或密码错误!
			</view>
		</view>
		
		<!-- 登录按钮 -->
		<view class="login_btn" @click="enterLogin">
			登录
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username:'',
				password:''
			}
		},
		methods: {
			// 点击注册 跳转到注册页面
			handleJump(){
				uni.navigateTo({
					url:"../register/register"
				})
			},
			// 点击登录 跳转到登录页面 提交
			enterLogin(){
				if(this.username && this.password){
					// 提交到后台
					// uni.setStorage({
					// 	key:"username",
					// 	data:this.username,
					// })
					// uni.setStorage({
					// 	key:"password",
					// 	data:this.password
					// })
					// 验证
					// uni.getStorage({
					// 	key:"username",
					// 	success: (res) => {
					// 		console.log(res.data);
					// 	}
					// })	
				}
			},
			// 获取用户名
			getUser(e){
				this.username = e.detail.value
			},
			// 获取密码
			getPws(e){
				this.password = e.detail.value
			}
		}
	}
</script>

<style lang="less" scoped>
	.header{
		position: fixed;
		top: 0;
		left: 0;
		z-index: 100;
		width: 100%;
		height: 88rpx;
		padding-top: var(--status-bar-height);
		background: #ffffff;
		// border-bottom: 2rpx solid rgba(39,40,50,0.1);
		.header-right{
			float: right;
			padding-right: 56rpx;
			.text{
				font-size: 36rpx;
				color: #333333;
				font-weight: 500;
				line-height: 88rpx;
			}
		}
	}

	.center_logo{
		margin-top: 88rpx;
		width: 100%;
		height: 226rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		image{
			width: 192rpx;
			height: 91.64rpx;
			margin-top: 12rpx;
		}
	}
	
	.login_warp{
		width: 100%;
		padding: 0 56rpx 0 58rpx;
		box-sizing: border-box;
		.login_title{
			width: 112rpx;
			height: 80rpx;
			font-size: 56rpx;
			color: #272832;
			letter-spacing: 0;
			font-weight: 500;
		}
		.login_news{
			width: 408rpx;
			height: 56rpx;
			font-size: 40rpx;
			color: rgba(39,40,50,0.50);
			letter-spacing: 0;
			font-weight: 400;
		}
		.login_username{
			margin-top: 68rpx;
			padding-bottom: 18rpx;
			border-bottom: 2rpx solid rgba(39,40,50,0.08);
		}
		.login_password{
			margin-top: 60rpx;
			padding-bottom: 18rpx;
			border-bottom: 2rpx solid rgba(39,40,50,0.08);
			
		}
		.tips{
			float: left;
			font-size: 20rpx;
			color: rgba(255,93,91,1);
		}
	}
	
	.login_btn{
		// margin-top: 118rpx;
		width: 520rpx;
		height: 96rpx;
		background: #FFE431;
		box-shadow: 0px 50rpx 38rpx -38rpx rgba(255,228,49,0.4);
		border-radius: 48rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin: 118rpx auto;
		font-size: 32rpx;
		color: #272832;
		letter-spacing: 0;
		font-weight: 500;
	}

</style>
